package com.inspire.springboot.config;

import okhttp3.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@Configuration
public class OkHttpConfig {

    @Bean
    public OkHttpClient okHttpClient() {
        return new OkHttpClient.Builder()
                .connectTimeout(30, TimeUnit.SECONDS)
                .readTimeout(30, TimeUnit.SECONDS)
                .writeTimeout(30, TimeUnit.SECONDS)
                .connectionPool(new okhttp3.ConnectionPool(5, 10, TimeUnit.SECONDS))
                .build();
    }

    // ObjectMapper 是 Jackson 提供的，Spring 默认已注册，但你可以自定义
    // 一般不需要手动注册，除非你要自定义序列化行为
}
